package cevent.source.cloudcenter.server.excel;/**
 * Created by Cevent on 2021/7/14.
 */

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.Map;

/**
 * @author cevent
 * @description 读取excel监听器
 * @date 2021/7/14 16:29
 */
public class EasyExcelTestListener extends AnalysisEventListener<EasyExcelTestDomain> {
    //按行读取excel内容，从第2行开始读取
    @Override
    public void invoke(EasyExcelTestDomain easyExcelTestDomain, AnalysisContext analysisContext) {
        //读取excel
        System.out.println("AnalysisEventListener中调用invoke读取到的doamin："+easyExcelTestDomain);
    }

    //读取第1行内容
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        super.invokeHeadMap(headMap, context);
        System.out.println("AnalysisEventListener中调用的invokeHeadMap读取的表头header："+headMap);
    }

    //读取之后执行
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        System.out.println("AnalysisEventListener中调用的doAfterAllAnalysed读取完毕："+analysisContext);
    }
}
